package lottoapp;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


/**
 *
 * @author Mark
 */
public class Player {
    private String firstname;
    private String lastname;
    private Set<Integer> numbers = new HashSet<>();

    public Player() {
    }
    
    
    private Player(String firstname,String lastname){
        this.firstname = firstname;
        this.lastname = lastname;
    }
    public static Player createPlayer(String firstname, String lastname) {
        return new Player(firstname,lastname);
    }

    public void addNumbers(Integer... number) {
        numbers.addAll(Arrays.asList(number));
    }

    public Set<Integer> remainingNumbersAfterProcessing(Set<LottoResult>  lottoResults) {
        Set<Integer> toScratch = new HashSet<>();
        toScratch.addAll(numbers);
        for(LottoResult lottoResult:lottoResults){
            toScratch.removeAll(lottoResult.getNumbers());
        }
        
        return toScratch;
    }

    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public Set<Integer> getNumbers() {
        return Collections.unmodifiableSet(numbers);
    }

   
    
    
}
